package com.fqy.thread02.atomic;

import java.util.concurrent.atomic.AtomicInteger;
/**
 * User: fqy
 * Date: 2021/9/1
 * Time: 14:38
 * Describe: AtomicInteger原理
 */
public class AtomicIntegerDemo {
    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger(5);

        System.out.println(atomicInteger.compareAndSet(5, 2021)+" 值"+atomicInteger.get());//2021
        System.out.println(atomicInteger.compareAndSet(5, 1024)+"值"+atomicInteger.get());//2021
    }
}
